|
This Article Is Taken From The Game Programming MegaSite, A Definitive Resource For Game Developers! |
What is a tile? A tile is like a regular bitmap or sprite, except it is meant to be repeated. For example, take a look at any NES scrolling game, like Super Mario Brothers. You�ll notice that all of the bricks look exactly the same. That is because the bricks have been drawn into a 16x16 tiled picture. When the picture is placed beside itself (for example, the steps at the end of the level), they seem to fit.
The advantage of tiles is that you can save a lot of memory. This was especially important in the days of the NES, where EVERY game used tiles. By repeating a graphic over and over, you could save megabytes of memory. These days, tiles are used for repeating patterns in 3-D textures. For example, if you look at the top of the water in Mario 64, you�ll notice the same pattern repeated over and over again.
It�s not that hard, actually. First, start by creating a new canvas. Choose the size of your texture, preferably in powers of 2 (2, 4, 8, 16, 32, 64, 128, 256, etc). This is done to help the programmer speed up the game. The reason why this helps is another article altogether. For this example, I�ll use 128x128.
After you have your canvas, draw the tile. Try to make it work as well as you can, by imagining that the edges of the texture will have to meet, so similar colors should be used on all opposing sides. Don�t worry about getting it perfect right away, but remember that it will look stupid if the contrast between the sides is too obvious.
Once you�ve got your tile, go to filter->other->offset. Now, choose wrap around, and then for the width and height parameters, enter exactly half the size of your texture. For example, if your texture is 128x128, enter 64x64. If you texture is 128x64, enter 64x32. If you did it properly, it should look something like this:
This is what the edges of your texture would look like if you tiled it right now. You see, mine has this nasty cross-hair type thing. To get rid of that, use the smudge tool. Zoom in and eliminate the cross-hair to your best ability. Then, offset the texture back into place. If you did it properly, you will have created a tile with very little difficulty. Here is the final result, tiled 3 times over: